package panel.downloadZipPanel
{
	import assists.Lang;
	import assists.URI;
	import assists.resource.ResourceLoader;
	
	import flash.display.Sprite;
	import flash.display.Stage;
	
	import main.ClientConstants;
	
	import panel.eating.DragContainerBox;
	
	public class ResourceListPage extends Sprite
	{
		private var _stage:Stage;
		private var _loader:ResourceLoader;
		private var _lang:Lang;
		private var _uri:URI;
		
		private var _dragContainer1:DragContainerBox;
		private var _resourceList1:ResourceList;
		
		private var showDetail:Function;
		private var onBackToCity:Function;
		private var chooseThisCity:Function;
		
		public function ResourceListPage(stage:Stage, loader:ResourceLoader, lang:Lang, uri:URI)
		{
			_stage = stage;
			_loader = loader;
			_lang = lang;
			_uri = uri;
			
			initThis();
		}
		
		private function initThis():void
		{
			_dragContainer1 = new DragContainerBox(_stage.stageWidth,_stage.stageHeight * .82,_stage);
			this.addChild(_dragContainer1);
			_dragContainer1.y = 0;
			
			_resourceList1 = new ResourceList(_stage,_loader,_lang,_uri);
		}
		
		public function set hasZip(bool:Boolean):void
		{
			_resourceList1.page2Bool = bool;
		}
		
		public function changeData(list:Array,page:int):void
		{
			_resourceList1.onShowDetail = showDetail;
			_resourceList1.onChooseCity = chooseThisCity;
			_resourceList1.backToCity = onBackToCity;
			_resourceList1.changeData(list,page);
			
			_dragContainer1.changeData([_resourceList1]);
		}
		
		public function set onShowDetail(func:Function):void
		{
			showDetail = func;
		}
		
		public function set onChooseCity(func:Function):void
		{
			chooseThisCity = func;
		}
		
		public function set backToCtiy(func:Function):void
		{
			onBackToCity = func;
		}
		
		public function clear():void
		{
			if(_stage){
				_stage = null;
				_loader = null;
				_lang = null;
				_uri = null;
				
				_resourceList1.clear();
				_resourceList1 = null;
			}
		}
	}
}